import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Interactive Carousel')),
        body: CarouselSlider(
          options: CarouselOptions(
            viewportFraction: 0.9,
            height: 250,
            autoPlay: true,
            enableInfiniteScroll: true,
          ),
          items:
              [
                {'text': 'Slide 1', 'color': Colors.yellow},
                {'text': 'Slide 2', 'color': Colors.green},
                {'text': 'Slide 3', 'color': Colors.blue},
              ].map((item) {
                return Container(
                  // width: MediaQuery.of(context).size.width,
                  width: 1200,
                  color: item['color'] as Color,
                  child: Center(
                    child: ElevatedButton(
                      onPressed: () {
                        print('Clicked on ${item['text']}');
                      },
                      child: Text(item['text'] as String),
                    ),
                  ),
                );
              }).toList(),
        ),
      ),
    );
  }
}
